<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">

<title>创客英雄</title>
<script src="http://how2j.cn/study/js/jquery/2.0.0/jquery.min.js"></script>
<link href="__TMPL__Portal/assets/css/ckyx.css" rel="stylesheet">
<script src="__TMPL__Portal/assets/js/ckyx.min.js"></script>
<link href="__TMPL__Portal/assets/css/main.css" rel="stylesheet">
    <script src="http://cdn.bootcss.com/blueimp-md5/1.1.0/js/md5.min.js"></script>
</head>

<body>
<!--header-->
<tc_include file="Portal:head" />
<div class="nav_box">
    <div class="container">
        <div class="row">
            <a class="logo col-md-2" href="index.html">
                <img src="__TMPL__Portal/assets/images/logo.png">
            </a>
            <tc_include file="Portal:nav" />
        </div>
    </div>
</div>

<!--banner_2-->
<div class="container banner_2">
	<img src="__TMPL__Portal/assets/images/zsxc.png">
</div>

<!--main3-->
<div class="container main3_box">
	<div class="ysbkbt">
        <div>用户注册</div>
    </div>
	<div class="main1_left main3 main5">
		<div class="twbk">
			<ul id="myTab" class="nav nav-tabs taban mcjz">
               <li><a href="#nrthree" data-toggle="tab">我是企业</a></li>
               <li><a href="#nrtwo" data-toggle="tab">我是老师</a></li>
               <li class="active"><a href="#nrone" data-toggle="tab">我是学生</a></li>
            </ul>
            <div id="myTabContent" class="tab-content mcjzxm">
               <div class="tab-pane fade in active" id="nrone">
                  <div class="dlkj">
                    <div class="dlkjnr">
                        <form id="form1" action="" method="post">
                            <div class="input-group mima yhxm">
                                <input id="trueName1" type="text" class="form-control" placeholder="用户姓名（请填写真实姓名）" >
                            </div>
                            <div class="input-group mima szxx">
                                <input id="school1" type="text" class="form-control" placeholder="所在学校">
                            </div>
                            <div class="input-group mima scnj">
                                <input id="grade1" type="text" class="form-control" placeholder="所处年级">
                            </div>
                            <div class="input-group mima zdlsxm">
                                <input id="teacherName" type="text" class="form-control" placeholder="指导老师姓名">
                            </div>
                            <div class="input-group mima">
                                <input id="psw1" type="text" class="form-control" placeholder="设置密码">
                            </div>
                            <div class="input-group mima">
                                <input id="surePsw1" type="text" class="form-control" placeholder="确认密码">
                            </div>
                            <div class="input-group youxiang">
                                <input id="email1" type="text" class="form-control" placeholder="设置邮箱（邮箱即为您的登录账号）">
                            </div>
                            <div class="btn-group denglu">
                                <button type="submit" class="btn btn-info dropdown-toggle">
                                    注&nbsp;&nbsp;册
                                </button>
                            </div>
                        </form>
                    </div>
                </div>
               </div>
               <div class="tab-pane fade" id="nrtwo">
                  <div class="dlkj">
                    <div class="dlkjnr">
                        <form id="form2" action="" method="post">
                        <div class="input-group mima yhxm">
                          <input id="trueName2" type="text" class="form-control" placeholder="用户姓名（请填写真实姓名）">
                        </div>
                        <div class="input-group mima szxx">
                          <input id="school2" type="text" class="form-control" placeholder="所在学校">
                        </div>
                        <div class="input-group mima">
                          <input id="psw2" type="text" class="form-control" placeholder="设置密码">
                        </div>
                        <div class="input-group mima">
                          <input id="surePsw2" type="text" class="form-control" placeholder="确认密码">
                        </div>
                        <div class="input-group youxiang">
                          <input id="email2" type="text" class="form-control" placeholder="设置邮箱（邮箱即为您的登录账号）">
                        </div>
                        <div class="btn-group denglu">
                            <button type="submit" class="btn btn-info dropdown-toggle">
                             注&nbsp;&nbsp;册
                            </button>
                        </div>
                            </form>
                    </div>
                </div>
               </div>
               <div class="tab-pane fade" id="nrthree">
                  <div class="dlkj">
                    <div class="dlkjnr">
                        <form id="form3" action="" method="post">
					<div class="input-group mima yhxm">
                          <input id="trueName3" type="text" class="form-control" placeholder="企业名称（请填写完整的企业名称）">
                        </div>
                        <div class="input-group mima">
                          <input id="psw3" type="text" class="form-control" placeholder="设置密码">
                        </div>
                        <div class="input-group mima">
                          <input id="surePsw3" type="text" class="form-control" placeholder="确认密码">
                        </div>
                        <div class="input-group youxiang">
                          <input id="email3" type="text" class="form-control" placeholder="设置邮箱（邮箱即为您的登录账号）">
                        </div>
                        <div class="btn-group denglu">
                            <button type="submit" class="btn btn-info dropdown-toggle">
                             注&nbsp;&nbsp;册
                            </button>
                        </div>
                            </form>
                    </div>
                </div>
               </div>
            </div>
        </div>
    </div>
</div>

<script src="__PUBLIC__/js/layer/layer.js"></script>
<script>
    $("#form1").submit(function(e){
        var trueName = $.trim($("#trueName1").val());
        var school = $.trim($("#school1").val());
        var grade = $.trim($("#grade1").val());
        var teacherName = $.trim($("#teacherName").val());
        var psw = $.trim($("#psw1").val());
        var surePsw = $.trim($("#surePsw1").val());
        var email = $.trim($("#email1").val());
        // 邮箱验证正则表达式
        var pattern = /^(\w-*\.*)+@(\w-?)+(\.\w{2,})+$/;
        if(trueName == ''){
            layer.msg('请输入真实姓名');
            return false;
        }else if(school == ""){
            layer.msg('请输入所在学校');
            return false;
        }else if(grade == ""){
            layer.msg('请输入所在年级');
            return false;
        }else if(teacherName == ""){
            layer.msg('请输入指导老师姓名');
            return false;
        }else if(psw == ""){
            layer.msg('请输入密码');
            return false;
        }else if(surePsw == ""){
            layer.msg('请输入确认密码');
            return false;
        }else if(surePsw != psw){
            layer.msg('两次输入的密码不一致');
            return false;
        }else if(email == ""){
            layer.msg('请输入邮箱');
            return false;
        }else if(!pattern.test(email)){
            layer.msg('邮箱格式不正确');
            return false;
        }
        psw = md5(psw);
        $.ajax({
            type: "POST",
            url: "{:U('Hacker/register')}",
            data: {name:trueName, school:school, grade:grade, teacher_name:teacherName,
                    user_pass:psw, user_email:email, type:1, user_type:2},
            success: function(result) {
                var result=eval("("+result+")");
                if(result.status){
                    layer.msg('注册成功',{time:500},function(){
                        location.href = "{:U('Hacker/dl')}";
                    });
                }else{
                    layer.msg(result.message);
                }
            }
        });
        return false;
    });

    $("#form2").submit(function(e){
        var trueName = $.trim($("#trueName2").val());
        var school = $.trim($("#school2").val());
        var psw = $.trim($("#psw2").val());
        var surePsw = $.trim($("#surePsw2").val());
        var email = $.trim($("#email2").val());
        // 邮箱验证正则表达式
        var pattern = /^(\w-*\.*)+@(\w-?)+(\.\w{2,})+$/;
        if(trueName == ''){
            layer.msg('请输入真实姓名');
            return false;
        }else if(school == ""){
            layer.msg('请输入所在学校');
            return false;
        }else if(psw == ""){
            layer.msg('请输入密码');
            return false;
        }else if(surePsw == ""){
            layer.msg('请输入确认密码');
            return false;
        }else if(surePsw != psw){
            layer.msg('两次输入的密码不一致');
            return false;
        }else if(email == ""){
            layer.msg('请输入邮箱');
            return false;
        }else if(!pattern.test(email)){
            layer.msg('邮箱格式不正确');
            return false;
        }
        psw = md5(psw);
        $.ajax({
            type: "POST",
            url: "{:U('Hacker/register')}",
            data: {name:trueName, school:school, user_pass:psw,
                user_email:email, type:2, user_type:2},
            success: function(result) {
                var result=eval("("+result+")");
                if(result.status){
                    layer.msg('注册成功',{time:500},function(){
                        location.href = "{:U('Hacker/dl')}";
                    });
                }else{
                    layer.msg(result.message);
                }
            }
        });
        return false;
    });

    $("#form3").submit(function(e){
        var trueName = $.trim($("#trueName3").val());
        var psw = $.trim($("#psw3").val());
        var surePsw = $.trim($("#surePsw3").val());
        var email = $.trim($("#email3").val());
        // 邮箱验证正则表达式
        var pattern = /^(\w-*\.*)+@(\w-?)+(\.\w{2,})+$/;
        if(trueName == ''){
            layer.msg('请输入真实姓名');
            return false;
        }else if(psw == ""){
            layer.msg('请输入密码');
            return false;
        }else if(surePsw == ""){
            layer.msg('请输入确认密码');
            return false;
        }else if(surePsw != psw){
            layer.msg('两次输入的密码不一致');
            return false;
        }else if(email == ""){
            layer.msg('请输入邮箱');
            return false;
        }else if(!pattern.test(email)){
            layer.msg('邮箱格式不正确');
            return false;
        }
        psw = md5(psw);
        $.ajax({
            type: "POST",
            url: "{:U('Hacker/register')}",
            data: {name:trueName, user_pass:psw,
                user_email:email, type:3, user_type:2},
            success: function(result) {
                var result=eval("("+result+")");
                if(result.status){
                    layer.msg('注册成功',{time:500},function(){
                        location.href = "{:U('Hacker/dl')}";
                    });
                }else{
                    layer.msg(result.message);
                }
            }
        });
        return false;
    });
</script>

<!--页脚-->
<div class="footer_box">
	<div class="sglj">
    	<a href="dl.html">登录</a><div>|</div>
        <a href="zc.html">注册</a><div>|</div>
        <a href="#top">回到顶部</a>
    </div>
    <div>Copyright&nbsp;©&nbsp;2017&nbsp;无锡创客英雄&nbsp;版权所有&nbsp;All&nbsp;Rights&nbsp;Reserved</div>
</div>




</body>
</html>
